package com.cy.pj.common.service;

import com.cy.pj.common.cache.Cache;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;

@Service
public class CacheService {

   //@Autowired
   /* @Qualifier("softCache")*///自动注入依赖
    private Cache cache;
//    public CacheService(){}

//    @Autowired//构造方法
//    public CacheService(@Qualifier("softCache")Cache cache){
//        this.cache = cache;
//    }

    @Autowired//set方法注入
    public void setCache(@Qualifier("softCache") Cache cache) {
        System.out.println("setCache()执行了");
        this.cache = cache;
    }

    public Cache getCache(){
        return cache;
    }


}
